package com.one.common.common.stateview;

import androidx.annotation.NonNull;

import com.one.common.R;
import com.one.common.common.stateview.item.EmptyItem;
import com.one.common.utils.StringUtils;
import com.one.common.view.multitytype.adapter.BaseItemBinder;
import com.one.common.view.multitytype.adapter.BaseViewHolderMulti;

/**
 * Author: zhulunjun
 * Email: zhulunjun@qq.com
 * CreateDate: 2018/12/1 15:32
 * Description：空列表的通用view
 **/
public class EmptyBinder extends BaseItemBinder<EmptyItem> {
    public EmptyBinder() {
        super(R.layout.layout_state_empty);
    }

    @Override
    protected void bindView(@NonNull BaseViewHolderMulti holder, @NonNull EmptyItem item) {
        if (StringUtils.isNotBlank(item.getEmptyStr())) {
            holder.setText(R.id.tv_empty, item.getEmptyStr());
        }

        if (item.getEmptyIcon() != -1) {
            holder.setImageResource(R.id.iv_empty, item.getEmptyIcon());
        }
    }
}
